home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / dev / c / minigl.lha / MiniGL / src / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-11  |  2.7 KB  |  122 lines

  1. /*
  2.  * $Id: init.c,v 1.4 2001/12/25 00:55:26 tfrieden Exp $
  3.  *
  4.  * $Date: 2001/12/25 00:55:26 $
  5.  * $Revision: 1.4 $
  6.  *
  7.  * (C) 1999 by Hyperion
  8.  * All rights reserved
  9.  *
  10.  * This file is part of the MiniGL library project
  11.  * See the file Licence.txt for more details
  12.  *
  13.  */
  14.  
  15. #include "sysinc.h"
  16. #include <stdio.h>
  17.  
  18.  
  19. static char rcsid[] UNUSED = "$Id: init.c,v 1.4 2001/12/25 00:55:26 tfrieden Exp $";
  20.  
  21. //surgeon: added 11-04-02 - initializes glDrawArrays to glDrawElements wrapper for clipping with compiled arrays
  22.  
  23. extern void Init_ArrayToElements_Warpper(void);
  24.  
  25.  
  26. struct Library *UtilityBase;
  27. struct IntuitionBase *IntuitionBase;
  28. struct GfxBase *GfxBase;
  29.  
  30. #ifndef __VBCC__
  31.     #ifndef __PPC__
  32.     struct Device *TimerBase = 0;
  33.     extern struct DosLibrary *DOSBase;
  34.     extern struct ExecBase *SysBase;
  35.     #endif
  36. #else
  37.     #ifndef __PPC__
  38.     struct Device *TimerBase = NULL;
  39.     extern struct DosLibrary *DOSBase;
  40.     extern struct ExecBase *SysBase;
  41.     #endif
  42. #endif
  43.  
  44. void MGL_SINCOS_Init(void);
  45.  
  46. #ifdef __PPC__
  47. struct Library *Warp3DPPCBase = NULL;
  48. #else
  49. struct Library *Warp3DBase = NULL;
  50. #endif
  51. struct Library *CyberGfxBase = NULL;
  52.  
  53.  
  54. GLboolean MGLInit(void)
  55. {
  56.     IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0L);
  57.     GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0L);
  58.     UtilityBase = OpenLibrary("utility.library", 0L);
  59. #ifdef __PPC__
  60.     Warp3DPPCBase = OpenLibrary("Warp3DPPC.library", 2L);
  61. #else
  62.     Warp3DBase = OpenLibrary("Warp3D.library", 2L);
  63. #endif
  64.     CyberGfxBase = OpenLibrary("cybergraphics.library", 0L);
  65.  
  66.     if (!IntuitionBase || !GfxBase || !UtilityBase || !CyberGfxBase ||
  67. #ifdef __PPC__
  68.         !Warp3DPPCBase)
  69. #else
  70.         !Warp3DBase)
  71. #endif
  72.     {
  73.         printf("Library initialization failed:\n");
  74.  
  75.         if (!IntuitionBase) printf("- intuition.library (How are you doing this ?)\n");
  76.         if (!GfxBase)       printf("- graphics.library (Strange!)\n");
  77. #ifdef __PPC__
  78.         if (!Warp3DPPCBase) printf("- Warp3DPPC.library\n");
  79. #else
  80.         if (!Warp3DBase)    printf("- Warp3D.library\n");
  81. #endif
  82.         if (!CyberGfxBase)  printf("- cybergraphics.library\n");
  83.         
  84.         MGLTerm();
  85.         return GL_FALSE;
  86.     }
  87.  
  88. #ifdef TRIGTABLES
  89.     MGL_SINCOS_Init();
  90. #endif
  91.  
  92.  
  93.     Init_ArrayToElements_Warpper(); //11-04-02
  94.  
  95.     return GL_TRUE;
  96.  
  97. }
  98.  
  99. void MGLTerm(void)
  100. {
  101.     if (CyberGfxBase)       CloseLibrary(CyberGfxBase);
  102.     CyberGfxBase = NULL;
  103.  
  104.     #ifdef __PPC__
  105.     if (Warp3DPPCBase)      CloseLibrary(Warp3DPPCBase);
  106.     Warp3DPPCBase = NULL;
  107.  
  108.     #else
  109.     if (Warp3DBase)         CloseLibrary(Warp3DBase);
  110.     Warp3DBase = NULL;
  111.     #endif
  112.  
  113.     if (IntuitionBase)      CloseLibrary((struct Library *)IntuitionBase);
  114.     IntuitionBase = NULL;
  115.  
  116.     if (GfxBase)            CloseLibrary((struct Library *)GfxBase);
  117.     GfxBase = NULL;
  118.  
  119.     if (UtilityBase)        CloseLibrary(UtilityBase);
  120.     UtilityBase = NULL;
  121. }
  122.